@extends('backend.layouts.main-iframe')
@section('content')
<div class="col-md-6">
    <div class="box box-primary">
        <form class="form-horizontal" action="{{URL('admin/permissions/')."/".encryptionUrl($permissionsDatas[0]['id'])}}" method="post">
            <div class="box-body">
                {{ method_field('PUT') }}
                {{ csrf_field() }}
                @foreach($permissionsDatas AS $key=>$permissionsData)
                <div class="form-group">
                    <label for="inputWarning">菜单名称</label>
                    <input type="text" class="form-control" name="permissions_name" value="{{$permissionsData['permissions_name']}}">
                    @if ($errors->has('permissions_name'))
                    <span class="help-block">
                        <strong style="color: #a94442;">{{ $errors->first('permissions_name') }}</strong>
                    </span>
                    @endif
                </div>
                <div class="form-group">
                    <label for="inputWarning">路由</label>
                    <input type="text" class="form-control" name="urls" placeholder="例如 admin/index" value="{{$permissionsData['urls']}}">
                    @if ($errors->has('urls'))
                    <span class="help-block">
                        <strong style="color: #a94442;">{{ $errors->first('urls') }}</strong>
                    </span>
                    @endif
                </div>
                <div class="form-group">
                    <label for="inputWarning">图标</label>
                    <input type="text" class="form-control" name="icons" placeholder="" value="{{$permissionsData['icon']}}">
                </div>
                <div class="box-header with-border">
                    <h3 class="box-title">权限：</h3>
                </div>
                <div class="box-body">
                    <div class="row">
                        @if(isset($permissionsData['son']))
                        @foreach($permissionsData['son'] AS $key=>$per)
                        <div class="col-xs-4" >
                            <input type="hidden" class="form-control" name="ids[]" value="{{$per['id']}}">
                            <input type="text" class="form-control" name="menus_name[]" placeholder="{{$per['permissions_name']}}" value="{{$per['permissions_name']}}">
                        </div>
                        <div class="col-xs-5">
                            <input type="text" class="form-control" name="permissions_url[]" placeholder="{{$per['urls']}}" value="{{$per['urls']}}">
                        </div>
                        <div class="col-xs-3">
                            <!--<input type="text" class="form-control" name="permissions_method[]"placeholder="{{$per['method']}}" value="{{$per['method']}}">-->
                            <select class="form-control" name="permissions_method[]">
                                <option value="GET" @if($per['method']=='GET') selected @endif>GET</option>
                                <option value="POST" @if($per['method']=='POST') selected @endif>POST</option>
                                <option value="PUT" @if($per['method']=='PUT') selected @endif>PUT</option>
                                <option value="DELETE" @if($per['method']=='DELETE') selected @endif>DELETE</option>
                                <option value="OPTIONS" @if($per['method']=='OPTIONS') selected @endif>OPTIONS</option>
                            </select>
                        </div>
                        @endforeach
                        @endif
                    </div>
                </div>
                @endforeach
                <div class="box-footer">
                    <button type="submit" class="btn btn-primary">提交</button>
                </div>
        </form>
    </div>
</div>
@endsection